#include "header.h"
int main(int argc,char*argv[])
{

    int pipe_write = open("1.pipe", O_WRONLY);
    int pipe_read = open("2.pipe", O_RDONLY);

    while(1){
        // 读取标准输入
        char buf[60] = {0};
        read(STDIN_FILENO, buf, sizeof(buf));

        // 写管道
        write(pipe_write, buf, sizeof(buf));

        // 读取管道
        bzero(buf, sizeof(buf));
        read(pipe_read, buf, sizeof(buf));

        // 打印
        printf("B: %s \n", buf);
    }

    close(pipe_read);
    close(pipe_write);

    return 0;
}